#include<iostream>
#include<string>
#include<queue>
using namespace std;
typedef struct node *BTree;
typedef struct node{
	char data;
	BTree lchild;
	BTree rchild;
}TNode;
BTree CreateBTree(string str,int i)
{
   int len;
   BTree bt;
   bt=new TNode;
   len=str.size();
   if(i>len-1 || i<=0) return NULL;
   if(str[i]=='#') return NULL;
   bt->data =str[i];
   bt->lchild =CreateBTree(str,2*i); 
   bt->rchild =CreateBTree(str,2*i+1); 	
   return bt;
}
void wide( int (&n)[100],BTree T,int i){
	if(T==NULL){
		n[i]=0;return;
	}
	n[i]++;
	if(T->lchild){
		wide(n,T->lchild,i+1);
	}
	if(T->rchild){
		wide(n,T->rchild,i+1);
	}
}
int main()
{
	BTree T;
	string str;
	int i,n[100];
	getline(cin,str); 
	T=CreateBTree(str,1);
	for(i=1;i<100;i++){
		n[i]=0;
	}
	wide(n,T,1);
	int max=-1;
	for(i=1;i<100;i++){
		if(n[i]>max)max=n[i];
	}
	cout<<max;
 } 
